<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.wanmait.travel.vo.Userinfo"%>
<%@page import="java.util.Random"%>
<%@page import="com.wanmait.travel.vo.Scenic"%>
<%@page import="com.wanmait.travel.vo.Tickit"%>
<%@page import="com.wanmait.travel.vo.ScenicTickitType"%>
<%@page import="com.wanmait.travel.util.ShopCar"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
    String path=request.getServletContext().getContextPath(); 
    Userinfo userinfo=(Userinfo)request.getSession().getAttribute("userinfo");
    %>
    <jsp:include page="/inc/header.jsp"></jsp:include>
<section>
<h2>支付界面</h2>

	<input type="button"  value="清空购物车"  onclick="shopClear()">
	
	<%
	ShopCar shopCar=(ShopCar)request.getSession().getAttribute("shopCar");
	for(ScenicTickitType stt:shopCar.getScenics()){
		Scenic scenic=stt.getScenic();
		Tickit tickitChild=stt.getTickitChild();
		Tickit tickitOld=stt.getTickitOld();
		Tickit tickitMan=stt.getTickitMan();
	%>
	<hr/>
	<input type="hidden" value="<%=userinfo.getId() %>"  id="userinfoId">
	<input type="hidden" value="<%=scenic.getId() %>"  id="scenicId">
		<div class="buycar">
		<%
	    if(tickitChild!=null) 
	    {
	    %>
			<div class="tickit_a">
			<%=scenic.getName()%><%=tickitChild.getTickitType().getType()%>&nbsp票价<%=tickitChild.getPrice()%>元
			&nbsp数量:<span id="tcNum"><%=tickitChild.getNum() %></span>张
			<div>
			在线支付&nbsp&nbsp
			<input type="button" value="+"   onclick="tcAdd()">
			<input type="text" value="<%=tickitChild.getTickitCount() %>" style="width:30px" id="tcValue" onfocus="tc()" onblur="tcb()">
			<input type="button" value="-"  onclick="tcDiff()">
			<input type="button" value="删除订单" onclick="deleteScenic('<%=tickitChild.getTickitTypeId() %>','<%=tickitChild.getScenicId() %>')">
			</div>
			
			</div>
		<%} %>
		
		
			
		<%
	    if(tickitOld!=null) 
	    {
	    %>
			<div class="tickit_a">
			<%=scenic.getName()%><%=tickitOld.getTickitType().getType()%>&nbsp票价<%=tickitOld.getPrice()%>元
			&nbsp数量:<span id="toNum"><%=tickitOld.getNum() %></span>张
			<div>
			在线支付&nbsp&nbsp

			<input  type="button" value="+"  onclick="toAdd()">
			<input type="text" value="<%=tickitOld.getTickitCount() %>" style="width:30px" id="toValue"  onfocus="to()" onblur="tob()">
			<input type="button" value="-"  onclick="toDiff()">
			<input type="button" value="删除订单" onclick="deleteScenic('<%=tickitOld.getTickitTypeId() %>','<%=tickitOld.getScenicId() %>')">
			</div>
			</div>
		<%} %>
		
		
		
		<%
	    if(tickitMan!=null) 
	    {
	    %>
			<div class="tickit_a">
			<%=scenic.getName()%><%=tickitMan.getTickitType().getType()%>&nbsp票价:<%=tickitMan.getPrice() %>元
			&nbsp数量:<span id="tmNum"><%=tickitMan.getNum() %></span>张
			<div>
			在线支付&nbsp&nbsp
			<input type="button" value="+" onclick="tmAdd()">
			<input type="text" value="<%=tickitMan.getTickitCount() %>" style="width:30px" id="tmValue" onfocus="tm()" onblur="tmb()">
			<input type="button" value="-" onclick="tmDiff()">
			<input type="button" value="删除订单" onclick="deleteScenic('<%=tickitMan.getTickitTypeId() %>','<%=tickitMan.getScenicId() %>')">
			</div>
			</div>
		<%} %>
			<%} %>
			</div>
			<hr/>
			<div id="priceAll">总价：<%=shopCar.getTotalPrice() %></div>
			
			<% if(shopCar!=null){ %>
			<input type="button" value="支付" id="pay" onclick="pay()">
			<% }%>
			
			
</section>
<jsp:include page="/inc/footer.jsp"></jsp:include>
<script type="text/javascript" src="/Travel/js/jquery-3.3.1.min.js"></script>
<script src="<%=path %>/js/shopCar.js?<%=new Random().nextInt() %>" type="text/javascript"></script>